﻿using MyabpDDD.Demo.Application.Education.Dto;
using MyabpDDD.Demo.Domain.Education;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace MyabpDDD.Demo.Application.Education
{
    public class EducationServices : ApplicationService, IEducationServices
    {
        private readonly IRepository<Student> _students1;
        private readonly IRepository<Classes> _classes1;
        public EducationServices(IRepository<Student> students, IRepository<Classes> classes)
        {
            _students1= students;
            _classes1= classes;
        }
        public IList<StudentInfoDto> QueryStudentAll()
        {
            var q1=_students1.AsQueryable();
            var q2=_classes1.AsQueryable();
            var query = from a in q1
                        join a2 in q2
                        on a.ClassID equals a2.Id
                        select new StudentInfoDto()
                        {
                            Name = a.Name,
                            ClassName = a2.ClassName
                        };

            return query.ToList();
        }
    }
}
